/**
 *
 * <T>  - 泛型参数，泛型参数占位符，泛型形参
 */
function identity<T>(value: T): T {
  return value;
}

const num1 = identity<string>("张三");
const num2 = identity<number>(100);

/**
 * 多个泛型参数的案例
 */
function identity1<T, U>(value: T, message: U): T {
  return value;
}

identity1<number, string>(18, "张三");

/**
 * 泛型参数的默认类型值
 */
interface A<T = string> {
  name: T;
}

const a1: A<number> = {
  name: 18,
};

/**
 * TS自动推导出 泛型参数类型
 */
function identity3<T, U>(value: T, message: U): T {
  return value;
}

identity3(18, "张三");

export {};
